package com.situ.lession1226.service.impl;

import com.situ.lession1226.dao.ProfessionalDAO;
import com.situ.lession1226.model.Professional;
import com.situ.lession1226.service.ProfessionalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class ProfessionalServiceImpl implements ProfessionalService {
    private ProfessionalDAO dao;

    @Autowired
    public void setDao(ProfessionalDAO dao) {
        this.dao = dao;
    }




    @Override
    public List<Professional> findAllBy() {
        //自动分页插件的操作
        //1.启动分页
//        try (Page<?> p = PageHelper.startPage(pi.getPageNo(), pi.getPageSize());) {
            //2.正常进行查询
            List<Professional> rommunitys = dao.findAllBy();

//            //3.获取分页数据
//            PageInfo<Professional> pif = new PageInfo<>(rommunitys);
//            pif.calcByNavigatePages(10);//根据导航页共10页进行计算
//            pi.setPageInfo(pif);//将分页对象缓存

            return rommunitys;
        }


//    @Override
//    public Professional findById(Integer id) {
//        return dao.findById(id);
//    }
//
    @Override
    public int deleteByIds(Integer[] ids) {
        return dao.deleteByIds(ids);
    }

    @Override
    public boolean save(Professional rommunity) {
        return dao.save(rommunity) > 0;
    }
//
//    @Override
//    public boolean update(Professional rommunity) {
//        return dao.update(rommunity) > 0;
//    }
}